Skip to content

Enzyme support example #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 51 commits into from
Jan 13, 2025
Merged

Enzyme support example #29

merged 51 commits into from
Jan 13, 2025

Conversation

nkoukpaizan
Copy link
Collaborator

This builds on earlier work from Asher and Slaven to add examples using the Enzyme automatic differentiation library.
There are two new tests compared to develop that should pass.

Building Enzyme from source is discussed in #23. I tested that approach as well as building LLVM and Enzyme through Spack, and both approaches work for this use-case.

@nkoukpaizan nkoukpaizan self-assigned this Oct 30, 2024
@pelesh pelesh requested review from alexander-novo and reid-g and removed request for stonecoldhughes November 4, 2024 15:36
@pelesh pelesh added the enhancement New feature or request label Nov 4, 2024
@pelesh
Copy link
Collaborator

pelesh commented Nov 4, 2024

CC @ashermancinelli

@ashermancinelli
Copy link
Contributor

Very cool to see!

@nkoukpaizan nkoukpaizan force-pushed the nicholson/enzyme-support branch from 65523d2 to fd75087 Compare December 19, 2024 15:49
Copy link
Collaborator

@reid-g reid-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compiled and ran with LLVM v18.1.8 and Enzyme v0.0.172 on Ubuntu 20.04.6 LTS (WSL). All test passed locally.

Besides the ninja issue, everything looks good to me.

Copy link
Contributor

@ashermancinelli ashermancinelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Let me know if you run into issues with clang/phase ordering/etc. Good luck!

Copy link
Collaborator

@pelesh pelesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest we merge this as it has basic infrastructure and tests for Enzyme support. We can expand testing and documentation through subsequent PRs.

I left a couple of nitpicking comments.

Comment on lines +2 to +3
#install(TARGETS ${CMAKE_CURRENT_BINARY_DIR}/EnzymeLibCheck DESTINATION bin)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to install Enzyme targets or this is out of scope for this PR?

Comment on lines +4 to +7
double square(double x) {
return x * x;
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be hard-wired double or configurable real_type?

@pelesh pelesh merged commit fb88866 into develop Jan 13, 2025
2 checks passed
@nkoukpaizan nkoukpaizan deleted the nicholson/enzyme-support branch January 22, 2025 17:53
pelesh added a commit that referenced this pull request Apr 14, 2025
* Preliminary support for automatic differentiation using Enzyme

* Build GridKit with Enzyme as dependency

* Add simple Enzyme tests

* Add Spack package for GridKit.

* gridkit +enzyme in CI.

* Update README with Enzyme dependency.

* Changed Enzyme add_custom_target name to fix build issues with Ninja.

---------

Co-authored-by: Asher Mancinelli <ashermancinelli@gmail.com>
Co-authored-by: Slaven Peles <peless@ornl.gov>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants